﻿<UserControl x:Class="Noc.Pomodoro.Controls.TaskToolbarControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             x:Name="ControlRoot">

  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Styles/ApplicationStyles.xaml" />
      </ResourceDictionary.MergedDictionaries>

      <Style x:Key="TaskToolbarPlayButton" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
        <Setter Property="Visibility" Value="Visible" />
        <Setter Property="ContentTemplate">
          <Setter.Value>
            <DataTemplate>
              <Image Source="/Pomodoro;component/Resources/Action-Start.png" />
            </DataTemplate>
          </Setter.Value>
        </Setter>
        <Style.Triggers>
          <DataTrigger Binding="{Binding IsRunning}" Value="True">
            <Setter Property="Visibility" Value="Collapsed" />
          </DataTrigger>
        </Style.Triggers>
      </Style>

      <Style x:Key="TaskToolbarInternalButton" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
        <Setter Property="Visibility" Value="Visible" />
        <Setter Property="ContentTemplate">
          <Setter.Value>
            <DataTemplate>
              <Image Source="/Pomodoro;component/Resources/Action-InternalInterrupt.png" />
            </DataTemplate>
          </Setter.Value>
        </Setter>
        <Style.Triggers>
          <DataTrigger Binding="{Binding IsRunning}" Value="False">
            <Setter Property="Visibility" Value="Collapsed" />
          </DataTrigger>
        </Style.Triggers>
      </Style>

      <Style x:Key="TaskToolbarExternalButton" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
        <Setter Property="Visibility" Value="Visible" />
        <Setter Property="ContentTemplate">
          <Setter.Value>
            <DataTemplate>
              <Image Source="/Pomodoro;component/Resources/Action-ExternalInterrupt.png" />
            </DataTemplate>
          </Setter.Value>
        </Setter>
        <Style.Triggers>
          <DataTrigger Binding="{Binding IsRunning}" Value="False">
            <Setter Property="Visibility" Value="Collapsed" />
          </DataTrigger>
        </Style.Triggers>
      </Style>

      <Style x:Key="TaskToolbarVoidButton" TargetType="Button" BasedOn="{StaticResource ToolbarButton}">
        <Setter Property="Visibility" Value="Visible" />
        <Setter Property="ContentTemplate">
          <Setter.Value>
            <DataTemplate>
              <Image Source="/Pomodoro;component/Resources/Action-Void.png" />
            </DataTemplate>
          </Setter.Value>
        </Setter>
        <Style.Triggers>
          <DataTrigger Binding="{Binding IsRunning}" Value="False">
            <Setter Property="Visibility" Value="Collapsed" />
          </DataTrigger>
        </Style.Triggers>
      </Style>

    </ResourceDictionary>
  </UserControl.Resources>

  <StackPanel Orientation="Horizontal" DataContext="{Binding Task, ElementName=ControlRoot}">
    <Button Style="{StaticResource TaskToolbarPlayButton}" Click="OnPlayButtonClicked" />
    <Button Style="{StaticResource TaskToolbarInternalButton}" Click="OnInternalButtonClicked" />
    <Button Style="{StaticResource TaskToolbarExternalButton}" Click="OnExternalButtonClicked" />
    <Button Style="{StaticResource TaskToolbarVoidButton}" Click="OnVoidButtonClicked" />
  </StackPanel>

</UserControl>